#include <pthread.h>

int main(){
    int err;
    pthread_rwlock_t rwlock;
    pthread_rwlock_init(&rwlock, NULL);
    pthread_rwlock_rdlock(&rwlock);
    pthread_rwlock_unlock(&rwlock);
    pthread_rwlock_wrlock(&rwlock);
    pthread_rwlock_unlock(&rwlock);

    err = pthread_rwlock_tryrdlock(&rwlock);
    err = pthread_rwlock_trywrlock(&rwlock);

    pthread_rwlock_destroy(&rwlock);
}